package io.kiki.sba.registry.server.clientInterface.converter;


import io.kiki.sba.registry.core.model.Data;
import io.kiki.sba.registry.core.model.MultiSegmentData;

import java.util.ArrayList;
import java.util.List;


public final class SegmentDataCounter {

    private final MultiSegmentData segmentData;

    private int dataCount;

    public SegmentDataCounter(MultiSegmentData segmentData) {
        this.segmentData = segmentData;
        this.dataCount = 0;
    }

    public void put(String zone, List<Data> datas) {
        if (datas == null) {
            datas = new ArrayList<>();
        }
        this.segmentData.getUnzipData().put(zone, datas);
        this.dataCount += datas.size();

        segmentData.getDataCount().put(zone, datas.size());
    }


    public MultiSegmentData getSegmentData() {
        return segmentData;
    }


    public int getDataCount() {
        return dataCount;
    }
}
